#include<iostream>
using namespace std;
int main()
{
	int k;
	double a, b,r;
	cin >> a >> b;
	for (k = 0; k < a; k++)
	{
		r = a - k * b;
		if (r < b)
		{
			printf("%g", r);
			break;
		}
	}
	return 0;
}